using Xunit;
using YTS.Tools;

namespace LanguageLearnTestCase.String
{
    public class DecimalStringFormat
    {
        [Theory]
        [InlineData("5.00", 5)]
        [InlineData("5.10", 5.1)]
        [InlineData("5.12", 5.12)]
        [InlineData("5.12", 5.123)]
        [InlineData("5.13", 5.125)]
        [InlineData("5.13", 5.129)]
        [InlineData("5.13", 5.12911)]
        [InlineData("5.13", 5.12917)]
        public void Decimal_ToStringF2(string result, decimal value)
        {
            Assert.Equal(result, value.ToString("F2"));
        }

        [Theory]
        [InlineData("5.00", 5)]
        [InlineData("5.10", 5.1)]
        [InlineData("5.12", 5.12)]
        [InlineData("5.12", 5.123)]
        [InlineData("5.12", 5.125)]
        [InlineData("5.12", 5.129)]
        [InlineData("5.12", 5.12911)]
        [InlineData("5.12", 5.12917)]
        public void Decimal_ToFixed2Bit_ToStringF2(string result, decimal value)
        {
            Assert.Equal(result, value.ToFixed(2).ToString("F2"));
        }
    }
}
